import request from '@/utils/request'

// 工业会话自学习智能生成策略
export function autoAddIndustryPolicy (params) {
  var data = fromData(params)
  return request({
    url: '/assist/autoAddIndustryPolicy',
    method: 'post',
    data
  })
}

// 获取工业会话自学习信息列表
export function getIndustryInfoArray (params) {
  var data = fromData(params)
  return request({
    url: '/assist/getIndustryInfoArray',
    method: 'post',
    data
  })
}

// 获取工业会话自学习子列表客户端
export function getIndustryServerClientArray (params) {
  var data = fromData(params)
  return request({
    url: '/assist/getIndustryServerClientArray',
    method: 'post',
    data
  })
}

// 获取工业会话自学习列表
export function getIndustryArray (params) {
  var data = fromData(params)
  return request({
    url: '/assist/getIndustryArray',
    method: 'post',
    data
  })
}

// 获取工业会话自学习子列表
export function getIndustryChildArray (params) {
  var data = fromData(params)
  return request({
    url: '/assist/getIndustryChildArray',
    method: 'post',
    data
  })
}

// 工业会话自学习智能生成模板
export function autoAddIndustryTemplate (params) {
  var data = fromData(params)
  return request({
    url: '/assist/autoAddIndustryTemplate',
    method: 'post',
    data
  })
}

function fromData (params) {
  let formData = new FormData()
  for (const it in params) {
    if (!Object.is(params[it], null) && !Object.is(params[it], '')) {
      formData.append(it, params[it])
    }
  }
  return formData
}
